import requests

'''code_list = {
    '1': '40,40,',
    '2': '114,35,',
    '3': '192,39,',
    '4': '257,36,',
    '5': '42,115,',
    '6': '119,107,',
    '7': '185,124,',
    '8': '272,117'
}
session = requests.session()
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36',
    'Referer': 'https://kyfw.12306.cn/otn/login/init'
}
url='https://kyfw.12306.cn/passport/captcha/captcha-image?login_site=E&module=login&rand=sjrand'
r=session.get(url,headers=headers,verify=False)
F=open('c://Users//Administrator//Desktop//code.png','wb')
F.write(r.content)
F.close()
code=input('请输入验证码：')
get_code=''
for i in code.split(','):
    get_code+=code_list[i]
data={
    'answer':get_code,
    'login_site':'E',
    'rand':'sjrand'
}
url='https://kyfw.12306.cn/passport/captcha/captcha-check'
r=session.post(url,data)
print(r.text)'''
session = requests.session()
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36',
    'Referer': 'https://kyfw.12306.cn/otn/passport?redirect=/otn/login/userLogin'
}
url='https://kyfw.12306.cn/passport/web/auth/uamtk'
data={
    'appid':'otn'
}

r=session.post(url,data=data,headers=headers)
print(r.text)